<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // Promise中的回调函数接收两个参数,
        // 一个是成功状态,一个是失败状态
        const p1 = new Promise((resolve,reject)=>{
            console.log(1);
            // 设置定时器模拟ajax
            setTimeout(() => {
                console.log(2);
                resolve(3)
                // reject(3)
                console.log(4);
            }, 3000);
           
        })
        console.log(p1);
        console.log(5);
        
    </script>
</body>
</html>